package io.netty.example.http.websocketx.benchmarkserver;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author sunzhuang
 * @date 2022年03月19日 5:46 PM
 */
public class ServerSocketTest {

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(8081);
        Socket accept = serverSocket.accept();
        BufferedReader reader = new BufferedReader(new InputStreamReader(accept.getInputStream()));
        PrintWriter printWriter = new PrintWriter(accept.getOutputStream(), true);
        String request, response;
        while ((request = reader.readLine()) != null) {
            System.out.println(request);
            if ("done".equals(request)) {
                break;
            }
            printWriter.println(request + "222");
        }
    }

}
